<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02_JS运算符</title>
</head>
<body>
<script>
    console.log(6/3);//2
    console.log(3/2);//1.5

    //比较时,如有任意一边出现了数字,会隐式转换为数字进行比较
    //如量表都是字符,比较的是字符的编码值
    //charCodeAt()查看字符编码,默认查看第一个字符,也可以根据下标查看其他字符编码
    console.log(3>10);//false
    console.log(3>'10');//false
    console.log('3'>10);//false
    console.log('宇'>'博');//true
    console.log('宇'.charCodeAt());//23431
    console.log('博'.charCodeAt());//21338
    console.log('3'>'10');//true
    console.log('3'.charCodeAt());//51
    //这里查的其实是1的编码('1 0中'第一个数1的编码)
    // 相当于console.log('10'.charCodeAt(0));,只有数字0-9有编码
    console.log('10'.charCodeAt());//49
    console.log('103'.charCodeAt(2));//51

    let a = 1;
    let b = true;
    console.log(a == b);//松散比较运算符,true,1==1  只比较值
    console.log(a === b);//严格比较运算符,false,先比较类型,再比较值 number≠boolean

    //三元运算符1 ? 2 : 3
    let c = 0;
    console.log(c == 0? 'true' : 'false');//true
    console.log(c = 0 ? 'YES' : 'NO');//NO =是赋值符号,变量c的值是0,转为布尔是false
</script>
</body>
</html>